package ShapeTriangle;

import java.util.Scanner;

/**
 * Created by Nishi on 24/12/13.
 * Display asterisks in horizontal , vertical and triangular shapes
 */
public class Triangle {

    public static void main(String[] args) {

        System.out.println("Enter a whole number : ");
        Scanner read = new Scanner(System.in);
        String input = read.nextLine();
        int inputNumber = Integer.parseInt(input);

        System.out.println("Horizontal Display");
        displayHorizontalLine(inputNumber);

        System.out.println("\nVertical Display");
        displayVerticalLine(inputNumber);

        System.out.println("\nRight Triangle");
        displayTriangle(inputNumber);
    }
    private static void displayHorizontalLine(int asteriskCount){
        for ( int i = 0; i< asteriskCount; i++){
            System.out.print("*");
        }
    }

    private static void displayVerticalLine(int lineCount) {
        for ( int i = 0; i<lineCount; i++){
            System.out.println("*");
        }
    }

    private static void displayTriangle(int lineCount){
        for( int i = 1 ;i <= lineCount ;i++){
            for (int j=1;j <= i ;j++ ){
                System.out.print("*");
            }
            System.out.println();
        }
    }

}
